﻿using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics.Contracts;

namespace NColony.Syndication.Receiver.Contracts
{
    /// <summary>
    /// Contract for <see cref="ISyndicationFeed"/>.
    /// </summary>
    [ContractClassFor(typeof(ISyndicationFeed))]
    public class ISyndicationFeedContract : ISyndicationFeed
    {
        /// <summary>
        /// Gets or sets the title.
        /// </summary>
        /// <value>The title.</value>
        public string Title
        {
            get
            {
                Contract.Ensures(Contract.Result<string>() != null, "Title will never be null");

                return default(string);
            }

            set
            {
                Contract.Requires(value != null, "Title cannot be null");
            }
        }

        /// <summary>
        /// Gets the items.
        /// </summary>
        /// <value>The items.</value>
        public ObservableCollection<ISyndicationFeedItem> Items
        {
            get
            {
                Contract.Ensures(Contract.Result<ObservableCollection<ISyndicationFeedItem>>() != null, "Items will never be null");

                return default(ObservableCollection<ISyndicationFeedItem>);
            }
        }

#pragma warning disable 0067
        /// <summary>
        /// Occurs when a property value is changing.
        /// </summary>
        public event PropertyChangingEventHandler PropertyChanging;

        /// <summary>
        /// Occurs when a property value changes.
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;
#pragma warning restore 0067
    }
}
